/**
 * @projectName: project02bywdmtz
 * @package: com.cskaoyan.controller
 * @className: Wx
 * @author: 冉夏
 * @description: TODO
 * @date: 2022/12/31 13:59
 * @version: 1.8
 */

package com.cskaoyan.controller;

import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.SearchIndexVo;
import com.cskaoyan.service.WxSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Base64;

@RequestMapping("wx/search")
@RestController
public class WxSearchController {
/*
* 在分类表内部点击搜索后的页面展示
* */
    @Autowired
    WxSearchService wxSearchService;
    @RequestMapping("index")
    public BaseRespVo searchByIndex(){
        SearchIndexVo searchIndexVo=wxSearchService.getSearchIndexInfoShow();
        return BaseRespVo.ok(searchIndexVo);
    }
    /*
    * 模糊查询类似的商品 且返回给服务器
    * */
    @RequestMapping("helper")
    public BaseRespVo searchHelper(String keyword){
        String[] helperArr=wxSearchService.searchHelper(keyword);
        return BaseRespVo.ok(helperArr);
    }
    @RequestMapping("clearhistory")
    /*
    * 删除所有的搜索的信息 将状态码全部修改为  0===>1
    * */
    public BaseRespVo clearHistory(){
        wxSearchService.clearHistory();
        return BaseRespVo.ok();
    }
}
